package com.clusterswisdom.horn.api.tmall.action.bill;

import java.util.List;

import com.alibaba.fastjson.JSONObject;
import com.clusterswisdom.horn.api.ioc.HornAction;
import com.clusterswisdom.horn.api.ioc.HornResponse;
import com.clusterswisdom.horn.api.ioc.api.ApiConfig;
import com.clusterswisdom.horn.api.tmall.action.AbstractTmallAction;
import com.clusterswisdom.horn.api.tmall.action.bill.event.EbizBill;

/**
 * 获取财务结算一览
 * 
 * @author bin
 *
 */
public class GetFinancialSettlementDetailAction extends AbstractTmallAction implements HornAction {

	@Override
	public HornResponse execute(ApiConfig config, JSONObject param)
			throws Exception {
		List<EbizBill> ebizBills=new GetFinancialSettlementAction().getEbizBills(param);
		EbizBill sumEbizBill=new EbizBill();
		for(EbizBill ebizBill:ebizBills){
			sumEbizBill.setAmount(sumEbizBill.getAmount()+ebizBill.getAmount());
			//sumEbizBill.setTotal_amount(sumEbizBill.getTotal_amount()+ebizBill.getTotal_amount());
		}
		return new HornResponse(true, sumEbizBill);
	}
	
	//获取Date时间字符串
	private String getDate(JSONObject param){
		return param.getString("Date");
		
	}
}
